package www.bwsensing.com.service;

import com.xxl.mq.client.consumer.IMqConsumer;
import com.xxl.mq.client.consumer.MqResult;
import com.xxl.mq.client.consumer.annotation.MqConsumer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import www.bwsensing.com.service.collection.database.CollectionSetService;

import javax.annotation.Resource;

/**
 * @author macos-zyj
 */
@MqConsumer(topic = "collection_network_model")
@Service
public class CollectionServiceQueueConsumer implements IMqConsumer {

    private Logger logger = LoggerFactory.getLogger(CollectionServiceQueueConsumer.class);

    @Resource
    private CollectionSetService collectionSetService;

    @Override
    public MqResult consume(String data) {
        logger.info("[ServiceQueueConsumer]:{}", data);
        collectionSetService.checkAndStart();
        return MqResult.SUCCESS;
    }
}
